import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children:[
      {
        path: '/map/index',
        name: 'mapIndex', 
        component: function () {
          return import('../views/map/MapIndex.vue')
        }
      },
      {
        path: '/home/index',
        name: 'homeIndex', 
        component: function () {
          return import('../views/home/HomeIndex.vue')
        }
      },
      {
        path: '/coupon/index',
        name: 'couponIndex', 
        component: function () {
          return import('../views/coupon/CouponIndex.vue')
        }
      },
      {
        path: '/my/coupon/index',
        name: 'myCouponIndex', 
        component: function () {
          return import('../views/coupon/MyCouponIndex.vue')
        }
      },
      {
        path: '/mine/index',
        name: 'mineIndex', 
        component: function () {
          return import('../views/mine/MineIndex.vue')
        }
      },
      {
        path: '/mine/point',
        name: 'minePoint',
        component: function () {
          return import('../views/mine/MyPoint.vue')
        }
      },{
        path: '/mine/station',
        name: 'mineStation',
        component: function () {
          return import('../views/mine/MyStation.vue')
        }
      },{
        path: '/mine/auth',
        name: 'mineAuth',
        component: function () {
          return import('../views/mine/MyAuth.vue')
        }
      },
      {
        path: '/code/index',
        name: 'codeIndex', 
        component: function () {
          return import('../views/code/ScanCodeIndex.vue')
        }
      },
      {path:'',redirect:'/home/index'}
    ]
  },
  {
    path: '/station/detail',
    name: 'stationDetail', 
    component: function () {
      return import('../views/home/StationDetail.vue')
    }
  } ,
  {
    path: '/user/login',
    name: 'userLogin', 
    component: function () {
      return import('../views/mine/UserLogin.vue')
    }
  },
  {
    path: '/user/registry',
    name: 'userRegistry', 
    component: function () {
      return import('../views/mine/UserRegistry.vue')
    }
  },
  {
    path: '/user/charge/money',
    name: 'userChargeMoney', 
    component: function () {
      return import('../views/mine/ChargeMoney.vue')
    }
  } ,
  {
    path: '/charging/start',
    name: 'chargingStart', 
    component: function () {
      return import('../views/code/ChargingStart.vue')
    }
  },{
    path: '/charging/starting',
    name: 'chargingStarting', 
    component: function () {
      return import('../views/code/ChargingStarting.vue')
    }
  },{
    path: '/charging/finish',
    name: 'chargingFinish', 
    component: function () {
      return import('../views/code/ChargingFinish.vue')
    }
  },
  {
    path: '/user/charge/money/doing',
    name: 'chargeMoneyDoing', 
    component: function () {
      return import('../views/mine/ChargeMoneyDoing.vue')
    }
  },
  {
    path: '/user/charge/money/success',
    name: 'chargeMoneySuccess', 
    component: function () {
      return import('../views/mine/ChargeMoneySuccess.vue')
    }
  },
  {
    path: '/user/charge/money/failed',
    name: 'chargeMoneyFailed', 
    component: function () {
      return import('../views/mine/ChargeMoneyFailed.vue')
    }
  }
  ,
  {
    path: '/user/charging/order',
    name: 'chargingOrder', 
    component: function () {
      return import('../views/order/ChargingOrder.vue')
    }
  },
  {
    path: '/user/charging/order/pay',
    name: 'ChargingOrderPay',
    component: function () {
      return import('../views/order/ChargingOrderPay.vue')
    }
  },
  {
    path: '/my/invite',
    name: 'myInvite', 
    component: function () {
      return import('../views/invite/MyInvite.vue')
    }
  },
  {
    path: '/user/pay/order',
    name: 'payOrder', 
    component: function () {
      return import('../views/order/PayOrder.vue')
    }
  },
  {
    path: '/income/myIncome',
    name: 'MyIncome', 
    component: function () {
      return import('../views/income/MyIncome.vue')
    }
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
